//gmsh version: 4.13.1
// 设置网格显示选项
Mesh.SurfaceFaces = 1;  // 显示3D单元的面
Mesh.VolumeEdges = 1;   // 显示3D单元的边
Mesh.Nodes = 1;         // 显示节点
Mesh.SaveAll = 1;       // 导出所有单元
Mesh.ElementOrder = 2;  // 设置网格为二阶

N_layers = 54;         // 横断面网格沿着轴向拉伸的次数
L = 1.0;                // 跨径为1.0 m
factor = 3;
lc1 = 0.009*factor;
lc2 = 0.007*factor;
lc3 = 0.004*factor;
lc4 = 0.0015*factor;
// 定义横断面
Point(1) = {-0.07, 0, 0, lc1};
Point(2) = {-0.03, 0, 0, lc2};
Point(3) = {-0.01, 0, 0, lc3};
Point(4) = {0.01, 0, 0, lc3};
Point(5) = {0.03, 0, 0, lc2};
Point(6) = {0.07, 0, 0, lc1};

Point(7) = {0.07, 0.01, 0, lc1};
Point(8) = {0.03, 0.01, 0, lc2};
Point(9) = {0.01, 0.01, 0, lc4};
Point(10) = {0.01, 0.03, 0, lc2};
Point(11) = {0.01, 0.08, 0, lc1};
Point(12) = {0.00, 0.08, 0, lc1};

Point(13) = {-0.01, 0.08, 0, lc1};
Point(14) = {-0.01, 0.03, 0, lc2};
Point(15) = {-0.01, 0.01, 0, lc4};
Point(16) = {-0.03, 0.01, 0, lc2};
Point(17) = {-0.07, 0.01, 0, lc1};

// 定义边界
Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 5};
Line(5) = {5, 6};
Line(6) = {6, 7};
Line(7) = {7, 8};
Line(8) = {8, 9};
Line(9) = {9, 10};
Line(10) = {10, 11};
Line(11) = {11, 12};
Line(12) = {12, 13};
Line(13) = {13, 14};
Line(14) = {14, 15};
Line(15) = {15, 16};
Line(16) = {16, 17};
Line(17) = {17, 1};

// 定义横断面
Curve Loop(1) = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
Plane Surface(1) = {1};

Point(18) = {0.0, 0.01, 0.0, lc4};// 在横断面内指定一个点
Point{18} In Surface{1}; // 将该点嵌入横断面中

Recombine Surface {1}; // 定义横断面网格为四边形网格

Mesh 2; // 生成横断面网格
Save "T_beam_cross.inp";

// 拉伸横断面生成箱梁
extrudeZ[] = Extrude {0, 0, L} {
  Surface{1};
  Layers{N_layers}; 
  Recombine;
};

// 生成网格
Mesh 3;
Save "T_beam.inp";